package com.junjiao.util.java;

import com.atlassian.jdk.utilities.runtimeinformation.RuntimeInformationBean;
import com.atlassian.jdk.utilities.runtimeinformation.RuntimeInformationBeanFactory;

public class MemoryUtil {
	public static String showMemStat() {
		RuntimeInformationBean bean = RuntimeInformationBeanFactory
				.getRuntimeInformationBean();
		StringBuffer sb = new StringBuffer(100);
		// sb.append("=====================").append("<br>");
		// sb.append("---------Memory------------").append("<br>");
		// sb.append("Total: " + bean.getTotalMemory() + "M").append("<br>");
		// sb.append("Used:  " + bean.getUsedMemory() + "M").append("<br>");
		// sb.append("Free:  " + bean.getFreeMemory() + "M").append("<br>");
		// sb.append("---------HeapMemory--------").append("<br>");
		// sb.append("Total: " + bean.getTotalHeapMemory() +
		// "M").append("<br>");
		// sb.append("Used:  " + bean.getTotalHeapMemoryUsed() +
		// "M").append("<br>");
		// sb.append("Free:  " + bean.getTotalHeapMemoryFree() +
		// "M").append("<br>");
		// sb.append("---------PermGenMemory------").append("<br>");
		// sb.append("Total: " + bean.getTotalPermGenMemory() +
		// "M").append("<br>");
		// sb.append("Used:  " + bean.getTotalPermGenMemoryUsed() +
		// "M").append("<br>");
		// sb.append("Free:  " + bean.getTotalPermGenMemoryFree() +
		// "M").append("<br>");
		// sb.append("============================").append("<br>");
		return sb.toString();
	}
}
